import { ApiCall } from "tsrpc";
import { ReqLook, ResLook } from "../../../../shared/master/shop/skill/PtlLook";
import god from "../../../../god";
import { player } from "../../../../model/fight/body/player";
import { template } from "../../../../shared/master/MsgAction";

export default async function (call: ApiCall<ReqLook, ResLook>) {
    call.succ({})
    let user = call.req._player as player;
    god.check();
    let bagArry = god.shop_skill.items;
    const lookItem = bagArry[call.req.idx - 1];
    if(typeof(lookItem) == 'undefined'){
        user.sendMsg(template.default,`ID为${call.req.idx}的商品已抢光啦.`)
        return;
    }
    let Msg =  lookItem.look(user);
    user.sendMsg(Msg.template, Msg.data)
}